<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:body>

	<ui:composition template="/commonLayout.xhtml">
		<ui:define name="content">
			<h:form>
				<h:messages id="messages"></h:messages>
				<p:schedule showWeekends="false" timeZone="Europe/Paris" locale="fr"
					styleClass="agenda" value="#{schedule.eventModel}"
					widgetVar="myschedule" axisFormat="H\'H\'" minTime="8" maxTime="20"
					allDaySlot="false" slotMinutes="30" timeFormat="H:mm { - H:mm}"
					view="agendaWeek">

					<p:ajax event="dateSelect" listener="#{schedule.onDateSelect}"
						update="eventDetails" oncomplete="addEventDialog.show()" />
					<p:ajax event="eventSelect" listener="#{schedule.onEventSelect}"
						update="eventDetails" oncomplete="eventDialog.show()" />
					<p:ajax event="eventMove" listener="#{schedule.onEventMove}"
						update="messages" />
					<p:ajax event="eventResize" listener="#{schedule.onEventResize}"
						update="messages" />

				</p:schedule>

				<p:dialog styleClass="agenda" widgetVar="eventDialog"
					header="Détails de l'évenement" showEffect="clip" hideEffect="clip">
					<h:panelGrid id="eventDetails" columns="2">
						<h:outputLabel for="title" value="Titre :" />
						<p:inputText id="title"
							value="#{schedule.selectedEvenement.title}" required="true"
							rendered="#{schecule.selectedEvenement.editable}" />
						<h:outputText value="#{schedule.selectedEvenement.title}"
							required="true"
							rendered="#{!schecule.selectedEvenement.editable}" />

						<h:outputLabel for="from" value="De :" />
						<p:calendar id="from" schedule="schedule"
							value="#{schedule.selectedEvenement.startDate}"
							rendered="#{schecule.selectedEvenement.editable}"></p:calendar>
						<h:outputText schedule="schedule"
							value="#{schedule.afficherDateDebut()}"
							rendered="#{!schecule.selectedEvenement.editable}"></h:outputText>

						<h:outputLabel for="to" value="à :" />
						<p:calendar id="to" schedule="schedule"
							value="#{schedule.selectedEvenement.endDate}"
							rendered="#{schecule.selectedEvenement.editable}"></p:calendar>
						<h:outputText schedule="schedule"
							value="#{schedule.afficherDateFin()}"
							rendered="#{!schecule.selectedEvenement.editable}"></h:outputText>

						</h:panelGrid>
				</p:dialog>

				<p:dialog styleClass="agenda" widgetVar="addEventDialog"
					header="Ajouter un evenement" showEffect="clip" hideEffect="clip">
					<h:panelGrid id="eventDetailsAdd" columns="2">
						<h:outputLabel for="titleAdd" value="Titre :" />
						<p:inputText id="titleAdd"
							value="#{schedule.selectedEvenement.title}" required="true" />
						<h:outputLabel for="fromAdd" value="De :" />
						<p:calendar id="fromAdd" schedule="schedule" pattern="dd/MM/yyyy HH:mm"
							value="#{schedule.selectedEvenement.startDate}" stepHour="1" stepMinute="30" timeZone="Europe/Paris" locale="fr" ></p:calendar>
						<h:outputLabel for="toAdd" value="à :" />
						<p:calendar id="toAdd" schedule="schedule" pattern="dd/MM/yyyy HH:mm"
							value="#{schedule.selectedEvenement.endDate}" stepHour="1" stepMinute="30" timeZone="Europe/Paris" locale="fr"></p:calendar>
						<h:outputLabel for="toAdd" value="Hebdomadaire :" />
<!-- 						<p:selectBooleanCheckbox label="hebdomadaire" value="#{schedule.selectedEvenement.allDay}"></p:selectBooleanCheckbox>
 -->						<h:commandButton value="Save" actionListener="#{schedule.addEvent}" oncomplete="myschedule.update();addEventDialog.hide();"/>

					</h:panelGrid>
				</p:dialog>
			</h:form>
		</ui:define>
	</ui:composition>

</h:body>
</html>